package com.demo.controller;

import com.demo.common.BaseRes;
import com.demo.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author leiliang
 * @version 1.0
 * @Description
 * @date 2020/12/14 14:51
 */

@Controller
@Slf4j
@RequestMapping("/test")
public class IndexController {

    @RequestMapping("/testAspect")
    @ResponseBody
    public BaseRes test(@RequestParam("name")String name) throws Exception{
        BaseRes res = new BaseRes();
        User user = new User();
        user.setId(25);
        user.setName("阿达");
        res.setSuccess("成功",user);
        return res;

    }

    @RequestMapping("/test1")
    @ResponseBody
    public BaseRes test1(String name) throws Exception{
        BaseRes res = new BaseRes();
        Integer inte = Integer.valueOf(name);
        int i = 1 / inte;
        return res;

    }
}
